import request from '@/utils/request'

// 查询工单列表
export function listWorkOrder(query) {
  return request({
    url: '/ldzl-sc/workOrder/list',
    method: 'get',
    params: query
  })
}

// 查询工单详细
export function getWorkOrder(workOrderId) {
  return request({
    url: '/ldzl-sc/workOrder/' + workOrderId,
    method: 'get'
  })
}

// 新增工单
export function addWorkOrder(data) {
  return request({
    url: '/ldzl-sc/workOrder',
    method: 'post',
    data: data
  })
}

// 修改工单
export function updateWorkOrder(data) {
  return request({
    url: '/ldzl-sc/workOrder',
    method: 'put',
    data: data
  })
}

// 删除工单
export function delWorkOrder(workOrderId) {
  return request({
    url: '/ldzl-sc/workOrder/' + workOrderId,
    method: 'delete'
  })
}

// 开始工单
export function startWorkOrder(workOrderId) {
  return request({
    url: '/ldzl-sc/workOrder/start/' + workOrderId,
    method: 'put'
  })
}

// 取消工单
export function cancelWorkOrder(workOrderIds) {
  return request({
    url: '/ldzl-sc/workOrder/cancel',
    method: 'put',
    data: workOrderIds
  })
}

// 结束工单
export function finishWorkOrder(workOrderId) {
  return request({
    url: '/ldzl-sc/workOrder/finish/' + workOrderId,
    method: 'put'
  })
}

// 撤回工单
export function withdrawWorkOrder(workOrderId) {
  return request({
    url: '/ldzl-sc/workOrder/withdraw/' + workOrderId,
    method: 'put'
  })
}

// 排产工单
export function scheduleWorkOrder(data) {
  return request({
    url: '/ldzl-sc/workOrder/schedule',
    method: 'put',
    data: data
  })
} 